class StickiesController < ApplicationController
  layout false
  def index
    @stickies = Sticky.find(:all)
  end
  
  def create_sticky
    @sticky = Sticky.new
    @sticky.body = "New Sticky"
    @sticky.t_loc = 100
    @sticky.l_loc = 100
    @sticky.created_by_id = current_user.id
    if @sticky.save
      redirect_to :action => :index
    end
  end

  def update_sticky_loc
    @sticky = Sticky.find(params[:id])
    if request.parameters[:l_loc] and request.parameters[:t_loc]
      @sticky.l_loc = request.parameters[:l_loc]
      @sticky.t_loc = request.parameters[:t_loc]
    end
    @sticky.updated_by_id = current_user.id
    if @sticky.save
      redirect_to :action => :index
    end
  end
  def update_sticky_body
    @sticky = Sticky.find(params[:id])
    @sticky.body = request.parameters[:sticky][:body]
    @sticky.updated_by_id = current_user.id
    if @sticky.save
      redirect_to :action => :index
    end
  end
  def destroy_sticky
    @sticky = Sticky.find(params[:id])
    @sticky.destroy
    redirect_to :action => :index
  end
end
